home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1998 / MacHack 1998.toast / Programming Contest / ~Solutions Submitted / Problem 03 - Guiness / Solution.p < prev   
Encoding:
Text File  |  1998-06-19  |  1.2 KB  |  54 lines  |  [TEXT/CWIE]

  1. (*
  2. Problem 03 - Perimeter
  3.  
  4. You are in charge of protecting a set of defenseless homeowners from predators
  5. that roam the area by constructing a single fence of minimum length that
  6. encloses all of the homes.  
  7.  
  8. The prototype for your solution is as follows:
  9.  
  10. typedef struct Node {
  11.     long xCoord;
  12.     long yCoord;
  13. } Node;
  14.  
  15. void Perimiter(
  16.     long numHomes,
  17.     Node homesToEnclose[],
  18.     long *numNodesInPerimiter,
  19.     long nodesInPerimiter[]
  20. );
  21.  
  22. You are given a list homesToEnclose of numHomes homes to protect  (numbered 0
  23. to numHomes-1) by constructing a fence around the homes. You should return a
  24. list nodesInPerimiter of the numNodesInPerimiter homes to be connected by a
  25. fence.  The fence must enclose all of the homes using the minimum amount of
  26. fencing material.
  27. *)
  28.  
  29. unit Solution;
  30.  
  31. interface
  32.  
  33. // Do not modify the interface
  34.  
  35.     uses
  36.         Types, Files;
  37.         
  38.     type Node = record
  39.             xCoord: SInt32;
  40.             yCoord: SInt32;
  41.         end;
  42.     type NodeArray = array [0..0] of Node;
  43.     type UInt32Array = array [0..0] of UInt32;
  44.         
  45.     procedure Perimeter( numHomes: UInt32; const homesToEnclose: NodeArray; var numNodesInPerimeter : UInt32; var nodesInPerimeter: UInt32Array);
  46.  
  47. implementation
  48.  
  49. // Fill in your solution and then submit this folder
  50.  
  51. // Team Name: FILL IN YOUR TEAM NAME!
  52.  
  53. end.
  54.